package com.tsystems.tuni.sportplanet.dao;

import java.util.List;

import javax.persistence.Query;

import com.tsystems.tuni.sportplanet.entity.Player;
import com.tsystems.tuni.sportplanet.entity.Team;

/**
 * 
 * @author Yuriy Eremin
 * 
 */
public class PlayerDAOImpl extends GenericDAOImpl<Player> implements PlayerDAO {

	public PlayerDAOImpl() {
		super();
	}

	@SuppressWarnings("unchecked")
	public List<Player> getAllPlayersFromTeam(Team team) {
		Query query = em
				.createQuery("select p from Player as p where p.team=:team");
		query.setParameter("team", team);
		return query.getResultList();
	}
	/*
	 * @Override public List<Player> getAllPlayers(Team team) { Session
	 * hibernateSession = this.getSession(); Transaction tr =
	 * hibernateSession.beginTransaction(); try {
	 * hibernateSession.createQuery(""); } catch {
	 * 
	 * } finally {
	 * 
	 * } }
	 */

}
